\contentsline {chapter}{\numberline {1}Introduction}{1}{chapter.1}
\contentsline {chapter}{\numberline {2}User's guide}{2}{chapter.2}
\contentsline {section}{\numberline {2.1}Command line arguments}{2}{section.2.1}
\contentsline {section}{\numberline {2.2}Command processor}{3}{section.2.2}
\contentsline {section}{\numberline {2.3}Editing}{3}{section.2.3}
\contentsline {section}{\numberline {2.4}Performance}{4}{section.2.4}
\contentsline {section}{\numberline {2.5}Disassembler}{4}{section.2.5}
\contentsline {section}{\numberline {2.6}Module system}{4}{section.2.6}
\contentsline {section}{\numberline {2.7}Library}{6}{section.2.7}
\contentsline {chapter}{\numberline {3}Command processor}{7}{chapter.3}
\contentsline {section}{\numberline {3.1}Current focus value and {\tt \#\#}}{7}{section.3.1}
\contentsline {section}{\numberline {3.2}Command levels}{8}{section.3.2}
\contentsline {section}{\numberline {3.3}Logistical commands}{9}{section.3.3}
\contentsline {section}{\numberline {3.4}Module commands}{9}{section.3.4}
\contentsline {section}{\numberline {3.5}Debugging commands}{9}{section.3.5}
\contentsline {section}{\numberline {3.6}Profiling commands}{11}{section.3.6}
\contentsline {subsection}{\numberline {3.6.1}How the profiler works}{16}{subsection.3.6.1}
\contentsline {section}{\numberline {3.7}Settings}{17}{section.3.7}
\contentsline {section}{\numberline {3.8}Inspection mode}{19}{section.3.8}
\contentsline {section}{\numberline {3.9}Command programs}{21}{section.3.9}
\contentsline {section}{\numberline {3.10}Building images}{21}{section.3.10}
\contentsline {section}{\numberline {3.11}Resource query and control}{22}{section.3.11}
\contentsline {section}{\numberline {3.12}Threads}{23}{section.3.12}
\contentsline {section}{\numberline {3.13}Quite obscure}{23}{section.3.13}
\contentsline {chapter}{\numberline {4}Module system}{25}{chapter.4}
\contentsline {section}{\numberline {4.1}Introduction}{25}{section.4.1}
\contentsline {section}{\numberline {4.2}The configuration language}{26}{section.4.2}
\contentsline {section}{\numberline {4.3}Interfaces}{28}{section.4.3}
\contentsline {section}{\numberline {4.4}Macros}{29}{section.4.4}
\contentsline {section}{\numberline {4.5}Higher-order modules}{30}{section.4.5}
\contentsline {section}{\numberline {4.6}Compiling and linking}{30}{section.4.6}
\contentsline {section}{\numberline {4.7}Semantics of configuration mutation}{30}{section.4.7}
\contentsline {section}{\numberline {4.8}Command processor support}{31}{section.4.8}
\contentsline {section}{\numberline {4.9}Configuration packages}{34}{section.4.9}
\contentsline {section}{\numberline {4.10}Discussion}{35}{section.4.10}
\contentsline {chapter}{\numberline {5}Libraries}{38}{chapter.5}
\contentsline {section}{\numberline {5.1}General utilities}{38}{section.5.1}
\contentsline {section}{\numberline {5.2}Pretty-printing}{40}{section.5.2}
\contentsline {section}{\numberline {5.3}Bitwise integer operations}{40}{section.5.3}
\contentsline {section}{\numberline {5.4}Byte vectors}{40}{section.5.4}
\contentsline {section}{\numberline {5.5}Sparse vectors}{41}{section.5.5}
\contentsline {section}{\numberline {5.6}Cells}{41}{section.5.6}
\contentsline {section}{\numberline {5.7}Queues}{41}{section.5.7}
\contentsline {section}{\numberline {5.8}Arrays}{42}{section.5.8}
\contentsline {section}{\numberline {5.9}Records}{44}{section.5.9}
\contentsline {subsection}{\numberline {5.9.1}Low-level access to records}{45}{subsection.5.9.1}
\contentsline {subsection}{\numberline {5.9.2}Record types}{45}{subsection.5.9.2}
\contentsline {section}{\numberline {5.10}Finite record types}{47}{section.5.10}
\contentsline {section}{\numberline {5.11}Sets over finite types}{48}{section.5.11}
\contentsline {section}{\numberline {5.12}Hash tables}{50}{section.5.12}
\contentsline {section}{\numberline {5.13}Port extensions}{50}{section.5.13}
\contentsline {section}{\numberline {5.14}Fluid bindings}{52}{section.5.14}
\contentsline {section}{\numberline {5.15}OS strings}{53}{section.5.15}
\contentsline {section}{\numberline {5.16}Shell commands}{54}{section.5.16}
\contentsline {section}{\numberline {5.17}Sockets}{55}{section.5.17}
\contentsline {section}{\numberline {5.18}Profiling}{56}{section.5.18}
\contentsline {section}{\numberline {5.19}Macros for writing loops}{58}{section.5.19}
\contentsline {subsection}{\numberline {5.19.1}{\tt Iterate}}{58}{subsection.5.19.1}
\contentsline {subsection}{\numberline {5.19.2}{\tt Reduce}}{59}{subsection.5.19.2}
\contentsline {subsection}{\numberline {5.19.3}Sequence types}{60}{subsection.5.19.3}
\contentsline {subsection}{\numberline {5.19.4}Synchronous sequences}{61}{subsection.5.19.4}
\contentsline {subsection}{\numberline {5.19.5}Examples}{61}{subsection.5.19.5}
\contentsline {subsection}{\numberline {5.19.6}Defining sequence types}{62}{subsection.5.19.6}
\contentsline {subsection}{\numberline {5.19.7}Expanded code}{63}{subsection.5.19.7}
\contentsline {section}{\numberline {5.20}Sorting lists and vectors}{64}{section.5.20}
\contentsline {subsection}{\numberline {5.20.1}Design rules}{64}{subsection.5.20.1}
\contentsline {paragraph}{What vs. how}{64}{section*.3}
\contentsline {paragraph}{Consistency across procedure signatures}{65}{section*.4}
\contentsline {paragraph}{Less-than parameter first, data parameter after}{65}{section*.5}
\contentsline {paragraph}{Ordering, comparison procedures and stability}{65}{section*.6}
\contentsline {paragraph}{All vector operations accept optional subrange parameters}{67}{section*.7}
\contentsline {paragraph}{Required vs.\ allowed side-effects}{67}{section*.8}
\contentsline {subsection}{\numberline {5.20.2}Procedure specification}{67}{subsection.5.20.2}
\contentsline {paragraph}{Procedure naming and functionality}{67}{section*.9}
\contentsline {paragraph}{Types of parameters and return values}{68}{section*.10}
\contentsline {subsubsection}{\texttt {sorting}---general sorting package}{68}{section*.11}
\contentsline {subsubsection}{Algorithm-specific sorting packages}{71}{section*.12}
\contentsline {paragraph}{\texttt {sorted}---sorted predicates}{71}{section*.13}
\contentsline {paragraph}{\texttt {list-merge-sort}---list merge sort}{71}{section*.14}
\contentsline {paragraph}{\texttt {vector-merge-sort}---vector merge sort}{71}{section*.15}
\contentsline {paragraph}{\texttt {vector-heap-sort}---vector heap sort}{72}{section*.16}
\contentsline {paragraph}{\texttt {vector-quick-sort}---vector quick sort}{72}{section*.17}
\contentsline {paragraph}{\texttt {vector-quick-sort3}---vector quick sort with 3-way comparisons}{73}{section*.18}
\contentsline {paragraph}{\texttt {vector-insert-sort}---vector insertion sort}{73}{section*.19}
\contentsline {paragraph}{\texttt {delete-neighbor-duplicates}---list and vector delete neighbor duplicates}{73}{section*.20}
\contentsline {paragraph}{\texttt {binary-searches}---vector binary search}{74}{section*.21}
\contentsline {subsection}{\numberline {5.20.3}Algorithmic properties}{75}{subsection.5.20.3}
\contentsline {section}{\numberline {5.21}Regular expressions}{76}{section.5.21}
\contentsline {subsection}{\numberline {5.21.1}Character sets}{76}{subsection.5.21.1}
\contentsline {subsection}{\numberline {5.21.2}Anchoring}{77}{subsection.5.21.2}
\contentsline {subsection}{\numberline {5.21.3}Composite expressions}{78}{subsection.5.21.3}
\contentsline {subsection}{\numberline {5.21.4}Case sensitivity}{78}{subsection.5.21.4}
\contentsline {subsection}{\numberline {5.21.5}Submatches and matching}{79}{subsection.5.21.5}
\contentsline {section}{\numberline {5.22}SRFIs}{80}{section.5.22}
\contentsline {chapter}{\numberline {6}Unicode}{83}{chapter.6}
\contentsline {section}{\numberline {6.1}Characters and their codes}{83}{section.6.1}
\contentsline {section}{\numberline {6.2}Character and string literals}{84}{section.6.2}
\contentsline {subsection}{\numberline {6.2.1}Character literals}{84}{subsection.6.2.1}
\contentsline {subsection}{\numberline {6.2.2}String literals}{84}{subsection.6.2.2}
\contentsline {subsection}{\numberline {6.2.3}Identifiers and symbol literals}{85}{subsection.6.2.3}
\contentsline {section}{\numberline {6.3}Character classification and case mappings}{85}{section.6.3}
\contentsline {section}{\numberline {6.4}SRFI 14}{86}{section.6.4}
\contentsline {section}{\numberline {6.5}R6RS}{86}{section.6.5}
\contentsline {section}{\numberline {6.6}I/O}{87}{section.6.6}
\contentsline {subsection}{\numberline {6.6.1}Text codecs}{87}{subsection.6.6.1}
\contentsline {subsection}{\numberline {6.6.2}Text-codec utilities}{87}{subsection.6.6.2}
\contentsline {subsection}{\numberline {6.6.3}Creating text codecs}{88}{subsection.6.6.3}
\contentsline {section}{\numberline {6.7}Default encodings}{89}{section.6.7}
\contentsline {chapter}{\numberline {7}Threads}{91}{chapter.7}
\contentsline {section}{\numberline {7.1}Creating and controlling threads}{91}{section.7.1}
\contentsline {section}{\numberline {7.2}Advanced thread handling}{92}{section.7.2}
\contentsline {section}{\numberline {7.3}Debugging multithreaded programs}{92}{section.7.3}
\contentsline {section}{\numberline {7.4}Optimistic concurrency}{93}{section.7.4}
\contentsline {section}{\numberline {7.5}Condition variables}{96}{section.7.5}
\contentsline {section}{\numberline {7.6}Mutual exclusion}{97}{section.7.6}
\contentsline {subsection}{\numberline {7.6.1}Locks}{97}{subsection.7.6.1}
\contentsline {subsection}{\numberline {7.6.2}Placeholders}{97}{subsection.7.6.2}
\contentsline {section}{\numberline {7.7}Writing custom synchronization abstractions}{98}{section.7.7}
\contentsline {section}{\numberline {7.8}Concurrent ML abstractions}{99}{section.7.8}
\contentsline {subsection}{\numberline {7.8.1}Basic rendezvous combinators}{99}{subsection.7.8.1}
\contentsline {subsection}{\numberline {7.8.2}Synchronous channels}{100}{subsection.7.8.2}
\contentsline {subsection}{\numberline {7.8.3}Synchronous variables}{100}{subsection.7.8.3}
\contentsline {subsubsection}{Placeholders}{101}{section*.22}
\contentsline {subsubsection}{Jars}{101}{section*.23}
\contentsline {subsection}{\numberline {7.8.4}Timeouts}{102}{subsection.7.8.4}
\contentsline {subsection}{\numberline {7.8.5}CML to Scheme correspondence}{102}{subsection.7.8.5}
\contentsline {chapter}{\numberline {8}Mixing Scheme 48 and C}{104}{chapter.8}
\contentsline {section}{\numberline {8.1}Available facilities}{104}{section.8.1}
\contentsline {subsection}{\numberline {8.1.1}Scheme structures}{105}{subsection.8.1.1}
\contentsline {subsection}{\numberline {8.1.2}C naming conventions}{105}{subsection.8.1.2}
\contentsline {subsection}{\numberline {8.1.3}Garbage collection and reference objects}{105}{subsection.8.1.3}
\contentsline {section}{\numberline {8.2}Shared bindings}{107}{section.8.2}
\contentsline {subsection}{\numberline {8.2.1}Exporting Scheme values to C}{107}{subsection.8.2.1}
\contentsline {subsection}{\numberline {8.2.2}Exporting C values to Scheme}{107}{subsection.8.2.2}
\contentsline {subsection}{\numberline {8.2.3}Complete shared binding interface}{108}{subsection.8.2.3}
\contentsline {section}{\numberline {8.3}Calling C functions from Scheme}{108}{section.8.3}
\contentsline {section}{\numberline {8.4}Dynamic loading}{109}{section.8.4}
\contentsline {section}{\numberline {8.5}Accessing Scheme data from C}{110}{section.8.5}
\contentsline {subsection}{\numberline {8.5.1}Constants}{111}{subsection.8.5.1}
\contentsline {subsection}{\numberline {8.5.2}Converting values}{111}{subsection.8.5.2}
\contentsline {subsection}{\numberline {8.5.3}C versions of Scheme procedures}{114}{subsection.8.5.3}
\contentsline {section}{\numberline {8.6}Calling Scheme functions from C}{115}{section.8.6}
\contentsline {section}{\numberline {8.7}Interacting with the Scheme heap}{115}{section.8.7}
\contentsline {subsection}{\numberline {8.7.1}Registering global references}{116}{subsection.8.7.1}
\contentsline {subsection}{\numberline {8.7.2}Local buffers}{117}{subsection.8.7.2}
\contentsline {subsection}{\numberline {8.7.3}Special treatment for byte vectors}{117}{subsection.8.7.3}
\contentsline {subsection}{\numberline {8.7.4}Memory overhead}{118}{subsection.8.7.4}
\contentsline {subsection}{\numberline {8.7.5}Keeping C data structures in the Scheme heap}{120}{subsection.8.7.5}
\contentsline {subsection}{\numberline {8.7.6}C code and heap images}{121}{subsection.8.7.6}
\contentsline {section}{\numberline {8.8}Using Scheme records in C code}{121}{section.8.8}
\contentsline {section}{\numberline {8.9}Raising exceptions from external code}{122}{section.8.9}
\contentsline {section}{\numberline {8.10}External events}{123}{section.8.10}
\contentsline {subsection}{\numberline {8.10.1}Collecting external events in external code}{124}{subsection.8.10.1}
\contentsline {subsection}{\numberline {8.10.2}Handling external events in Scheme}{125}{subsection.8.10.2}
\contentsline {section}{\numberline {8.11}Unsafe functions and macros}{126}{section.8.11}
\contentsline {section}{\numberline {8.12}Converting external code to the new foreign-function interface}{127}{section.8.12}
\contentsline {chapter}{\numberline {9}Access to POSIX}{129}{chapter.9}
\contentsline {section}{\numberline {9.1}Process primitives}{129}{section.9.1}
\contentsline {subsection}{\numberline {9.1.1}Process creation and termination}{130}{subsection.9.1.1}
\contentsline {subsection}{\numberline {9.1.2}{\tt Exec}}{130}{subsection.9.1.2}
\contentsline {section}{\numberline {9.2}Signals}{131}{section.9.2}
\contentsline {subsection}{\numberline {9.2.1}POSIX signals}{131}{subsection.9.2.1}
\contentsline {subsection}{\numberline {9.2.2}Other signals}{132}{subsection.9.2.2}
\contentsline {subsection}{\numberline {9.2.3}Sending signals}{133}{subsection.9.2.3}
\contentsline {subsection}{\numberline {9.2.4}Receiving signals}{133}{subsection.9.2.4}
\contentsline {section}{\numberline {9.3}Process environment}{134}{section.9.3}
\contentsline {subsection}{\numberline {9.3.1}Process identification}{134}{subsection.9.3.1}
\contentsline {subsection}{\numberline {9.3.2}Environment variables}{134}{subsection.9.3.2}
\contentsline {section}{\numberline {9.4}Users and groups}{134}{section.9.4}
\contentsline {section}{\numberline {9.5}OS and machine identification}{135}{section.9.5}
\contentsline {section}{\numberline {9.6}Files and directories}{136}{section.9.6}
\contentsline {subsection}{\numberline {9.6.1}Directory streams}{136}{subsection.9.6.1}
\contentsline {subsection}{\numberline {9.6.2}Working directory}{136}{subsection.9.6.2}
\contentsline {subsection}{\numberline {9.6.3}File creation and removal}{136}{subsection.9.6.3}
\contentsline {subsection}{\numberline {9.6.4}File information}{138}{subsection.9.6.4}
\contentsline {subsection}{\numberline {9.6.5}File modes}{139}{subsection.9.6.5}
\contentsline {subsection}{\numberline {9.6.6}Symbolic links}{140}{subsection.9.6.6}
\contentsline {section}{\numberline {9.7}Time and Date}{140}{section.9.7}
\contentsline {subsection}{\numberline {9.7.1}Time}{141}{subsection.9.7.1}
\contentsline {subsection}{\numberline {9.7.2}Date}{141}{subsection.9.7.2}
\contentsline {section}{\numberline {9.8}I/O}{143}{section.9.8}
\contentsline {section}{\numberline {9.9}Regular expressions}{145}{section.9.9}
\contentsline {section}{\numberline {9.10}Syslog facility}{146}{section.9.10}
\contentsline {section}{\numberline {9.11}Error codes}{149}{section.9.11}
\contentsline {subsection}{\numberline {9.11.1}POSIX errnos}{150}{subsection.9.11.1}
\contentsline {section}{\numberline {9.12}C to Scheme correspondence}{152}{section.9.12}
\contentsline {chapter}{\numberline {10}{Bibliography}}{154}{chapter*.30}
